package com.zxj.common.core.enums;

import lombok.Getter;

@Getter
public enum DifficultyLevel {
    EASY(1, "简单"),
    MEDIUM(2, "中等"),
    HARD(3, "困难");

    private final int code;
    private final String desc;

    DifficultyLevel(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static DifficultyLevel getByCode(int code) {
        for (DifficultyLevel value : values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
